package com.lanp.springmybatis.model;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;

public class Event {
    private Long id;

    private String key;

    private String name;

    private Long classifyId;

    private String eventType;

    private String eventStatus;

    private Boolean eventEnable;

    private String priority;

    private String recallStatus;

    private String sender;

    private String triggerRemark;

    private String industry;

    private Long timeStrategyId;

    private Boolean ifTask;

    private Date taskPushTime;

    private Date pushTime;

    private String creater;

    private Date createtime;

    private Date updateTime;

    private String updateNickname;

    private Date delTime;

    private String delNickname;

    private Boolean available;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key == null ? null : key.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public Long getClassifyId() {
        return classifyId;
    }

    public void setClassifyId(Long classifyId) {
        this.classifyId = classifyId;
    }

    public String getEventType() {
        return eventType;
    }

    public void setEventType(String eventType) {
        this.eventType = eventType == null ? null : eventType.trim();
    }

    public String getEventStatus() {
        return eventStatus;
    }

    public void setEventStatus(String eventStatus) {
        this.eventStatus = eventStatus == null ? null : eventStatus.trim();
    }

    public Boolean getEventEnable() {
        return eventEnable;
    }

    public void setEventEnable(Boolean eventEnable) {
        this.eventEnable = eventEnable;
    }

    public String getPriority() {
        return priority;
    }

    public void setPriority(String priority) {
        this.priority = priority == null ? null : priority.trim();
    }

    public String getRecallStatus() {
        return recallStatus;
    }

    public void setRecallStatus(String recallStatus) {
        this.recallStatus = recallStatus == null ? null : recallStatus.trim();
    }

    public String getSender() {
        return sender;
    }

    public void setSender(String sender) {
        this.sender = sender == null ? null : sender.trim();
    }

    public String getTriggerRemark() {
        return triggerRemark;
    }

    public void setTriggerRemark(String triggerRemark) {
        this.triggerRemark = triggerRemark == null ? null : triggerRemark.trim();
    }

    public String getIndustry() {
        return industry;
    }

    public void setIndustry(String industry) {
        this.industry = industry == null ? null : industry.trim();
    }

    public Long getTimeStrategyId() {
        return timeStrategyId;
    }

    public void setTimeStrategyId(Long timeStrategyId) {
        this.timeStrategyId = timeStrategyId;
    }

    public Boolean getIfTask() {
        return ifTask;
    }

    public void setIfTask(Boolean ifTask) {
        this.ifTask = ifTask;
    }

    public Date getTaskPushTime() {
        return taskPushTime;
    }

    public void setTaskPushTime(Date taskPushTime) {
        this.taskPushTime = taskPushTime;
    }

    public Date getPushTime() {
        return pushTime;
    }

    public void setPushTime(Date pushTime) {
        this.pushTime = pushTime;
    }

    public String getCreater() {
        return creater;
    }

    public void setCreater(String creater) {
        this.creater = creater == null ? null : creater.trim();
    }

    public Date getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Date createtime) {
        this.createtime = createtime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getUpdateNickname() {
        return updateNickname;
    }

    public void setUpdateNickname(String updateNickname) {
        this.updateNickname = updateNickname == null ? null : updateNickname.trim();
    }

    public Date getDelTime() {
        return delTime;
    }

    public void setDelTime(Date delTime) {
        this.delTime = delTime;
    }

    public String getDelNickname() {
        return delNickname;
    }

    public void setDelNickname(String delNickname) {
        this.delNickname = delNickname == null ? null : delNickname.trim();
    }

    public Boolean getAvailable() {
        return available;
    }

    public void setAvailable(Boolean available) {
        this.available = available;
    }

    public enum Column {
        id("id", "id", "BIGINT", false),
        key("key", "key", "VARCHAR", false),
        name("name", "name", "VARCHAR", false),
        classifyId("classify_id", "classifyId", "BIGINT", false),
        eventType("event_type", "eventType", "VARCHAR", false),
        eventStatus("event_status", "eventStatus", "VARCHAR", false),
        eventEnable("event_enable", "eventEnable", "BIT", false),
        priority("priority", "priority", "CHAR", false),
        recallStatus("recall_status", "recallStatus", "VARCHAR", false),
        sender("sender", "sender", "VARCHAR", false),
        triggerRemark("trigger_remark", "triggerRemark", "VARCHAR", false),
        industry("industry", "industry", "VARCHAR", false),
        timeStrategyId("time_strategy_id", "timeStrategyId", "BIGINT", false),
        ifTask("if_task", "ifTask", "BIT", false),
        taskPushTime("task_push_time", "taskPushTime", "TIMESTAMP", false),
        pushTime("push_time", "pushTime", "TIMESTAMP", false),
        creater("creater", "creater", "VARCHAR", false),
        createtime("createtime", "createtime", "TIMESTAMP", false),
        updateTime("update_time", "updateTime", "TIMESTAMP", false),
        updateNickname("update_nickname", "updateNickname", "VARCHAR", false),
        delTime("del_time", "delTime", "TIMESTAMP", false),
        delNickname("del_nickname", "delNickname", "VARCHAR", false),
        available("available", "available", "BIT", false);

        private static final String BEGINNING_DELIMITER = "\"";

        private static final String ENDING_DELIMITER = "\"";

        private final String column;

        private final boolean isColumnNameDelimited;

        private final String javaProperty;

        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public static Column[] all() {
            return Column.values();
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }

        public String getAliasedEscapedColumnName() {
            return this.getEscapedColumnName();
        }
    }
}